package com.game.code;

import org.jbox2d.collision.shapes.PolygonShape;
import org.jbox2d.dynamics.Body;
import org.jbox2d.dynamics.BodyDef;
import org.jbox2d.dynamics.BodyType;
import org.jbox2d.dynamics.FixtureDef;
import org.jbox2d.dynamics.World;

public class Brick {
	
	Body body;
	
	public Brick(World world,float x,float y,float w,float h){
		BodyDef brick_bd = new BodyDef();
	    brick_bd.type = BodyType.STATIC;
	    
	    brick_bd.position.set(x,y);

	    body = world.createBody(brick_bd);

	    PolygonShape brick_shape = new PolygonShape();
		brick_shape.setAsBox(w/2,h/2);
		
		FixtureDef brick_fd = new FixtureDef();
		brick_fd.shape = brick_shape;
		brick_fd.density = 0.2f;
		brick_fd.friction=0;
		brick_fd.restitution = 0.0f;
		
		body.createFixture(brick_fd);
		body.setUserData("brick");
	}
}
